﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BonjourHotel.Core.Localization;
using System.Reflection;

namespace BonjourHotel.Application.Controls.StatusBar
{
    public partial class CurrentVersion : System.Web.UI.UserControl
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string currentVersionText = LocaleManager.GetLocaleString("StatusBar.CurrentVersion.Text");
                Assembly webAssembly = Assembly.GetExecutingAssembly();
                AssemblyName coreAssembly = webAssembly.GetReferencedAssemblies().Where(x => x.Name == "BonjourHotel.Core").FirstOrDefault();
                string WebVersion = webAssembly.GetName().Version.ToString();
                string CoreVersion = coreAssembly.Version.ToString();
                lblCurrentVersion.Text = currentVersionText;
                lblCurrentVersion.Text += " - UI: " + WebVersion;
                lblCurrentVersion.Text += " - Core: " + CoreVersion;
            }
        }
    }
}